using UnityEngine;
using System.Collections;

public abstract class Character : MonoBehaviour
{
	
	public int Health;
	public bool Invencible;
	
	protected abstract void OnHit(Collider collider);
	
	protected virtual void OnDamage(Collider colllider)
	{
		if (Invencible)
			return;
		Health--;
		if (Health <= 0)
			OnDeath(colllider);
	}
	
	protected virtual void OnDeath(Collider colllider)
	{
		Destroy(gameObject);
	}
	
	void OnTriggerEnter(Collider collider)
	{
		OnHit(collider);
	}
	
}